package com.ace3l.legal.gwt.domainmodule.gwt;


import com.google.gwt.user.client.rpc.IsSerializable;

import java.util.*;
import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: ageer
 * Date: Jul 26, 2008
 * Time: 5:29:53 AM
 * To change this template use File | Settings | File Templates.
 */
public class GWTProject implements IsSerializable {
    private Integer id;
    private String title;
    private String description;
    private Date dueDate;
    private GWTLawFirm lawFirm;
    private Integer hoursAllotted;
    private Integer hoursCompleted;
    private HashSet<GWTStudent> assignedStudents = new HashSet<GWTStudent>();
    private String workflowStage;
//    private List workflowEvents = new ArrayList();

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getDueDate() {
        return dueDate;
    }

    public void setDueDate(Date dueDate) {
        this.dueDate = dueDate;
    }

    public GWTLawFirm getLawFirm() {
        return lawFirm;
    }

    public void setLawFirm(GWTLawFirm lawFirm) {
        this.lawFirm = lawFirm;
    }

    public Integer getHoursAllotted() {
        return hoursAllotted;
    }

    public void setHoursAllotted(Integer hoursAllotted) {
        this.hoursAllotted = hoursAllotted;
    }

    public Integer getHoursCompleted() {
        return hoursCompleted;
    }

    public void setHoursCompleted(Integer hoursCompleted) {
        this.hoursCompleted = hoursCompleted;
    }

    public Set<GWTStudent> getAssignedStudents() {
        return assignedStudents;
    }

    public void setAssignedStudents(HashSet<GWTStudent> assignedStudents) {
        this.assignedStudents = assignedStudents;
    }

    public void addAssignedStudent(GWTStudent s) {
        assignedStudents.add(s);
    }
    public String getWorkflowStage() {
        return workflowStage;
    }

    public void setWorkflowStage(String workflowStage) {
        this.workflowStage = workflowStage;
    }

    public void secureForRole(String role) {
        if (role.equals(GWTRole.STUDENT)) {
            lawFirm.secureForRole(role);
            assignedStudents.clear();
        }
    }
}
